/**
 * 	*****************************************************************************
 *				sweetalert 插件域 闭包处理    作者：张鹏鹏   电话：15158822934
 *	*****************************************************************************
 */
(function($){
	
	$.fn.sweetAlert = function(options){
		var defaluts = 
		{
			 id:".demo1",
			 title:"稻普控股集团",
			 text:"欢迎进入稻普控股股集团科技组",
			 type:"basic",		//[basic,success,warning,warning]
			 showCancelButton:true,
			 confirmButtonColor:"#DD6B55",
			 closeOnConfirm: false,
			 closeOnCancel: false,
			 cancelButtonText: "确定",
			 confirmButtonText: "删除",
			 callback: function(){}
		};
		var opts = $.extend(defaluts, options);
		
		if(opts.type == "basic")
		{
			$(opts.id).click(function () {
                swal({
                    title: opts.title,
                    text: opts.text
                });
            });
			return;
		}
		
		if(opts.type == "success")
		{
			$(opts.id).click(function () {
                swal({
                    title: opts.title,
                    text: opts.text,
                    type: "success"
                });
            });
		   return;
		}
		
		if(opts.type == "warning"){
			$(opts.id).click(function () {
                swal({
                    title: opts.title,
                    text: opts.text,
                    type: "warning",
                    showCancelButton: opts.showCancelButton,
                    confirmButtonColor: opts.confirmButtonColor,
                    confirmButtonText: opts.confirmButtonText,
                    closeOnConfirm: opts.closeOnConfirm
                },opts.callback);
            });
			
			return;
		}
		
		$(opts.id).click(function () {
            swal({
                    title: opts.title,
                    text: opts.text,
                    type: "warning",
                    showCancelButton: opts.showCancelButton,
                    confirmButtonColor: opts.confirmButtonColor,
                    confirmButtonText: opts.confirmButtonText,
                    cancelButtonText: opts.confirmButtonText,
                    closeOnConfirm: false,
                    closeOnCancel: false
                },opts.callback);
        });
	};
})(jQuery);